<template>
	<view class="home">
		<view style="background: #fff;padding-bottom: 10rpx;">
			<u-steps :current="current">
				<u-steps-item v-for="(item,index) in numList" :key="index" :title="item.name" @click.native="step(index)"></u-steps-item>
			</u-steps>
		</view>
		
		<view class="" v-if="current == 0">
			<view class="list">
				<view class="list_meun">
					<text class="list_meun_title">活动标题</text>
					<input type="text" placeholder="请输入活动标题" class="list_meun_input">
				</view>
				<view class="list_meun1">
					<view class="list_meun_title list_meun1_title">活动标题</view>
					<view class="list_meun_dect">建议尺寸 750px*464px</view>
					<u-upload
						:fileList="fileList"
						@afterRead="afterRead"
						@delete="deletePic"
						name="6"
						multiple
						:maxCount="1"
						width="250"
						height="150"
					>
					<view class="upload_img" style="border: 2rpx solid #eee;">
						<u-icon name="plus-circle-fill" color="#2979ff" size="28"></u-icon>
						<text>上传图片</text>
					</view>
					</u-upload>
				</view>
				<view class="list_meun1">
					<view class="list_meun_title list_meun1_title">活动说明</view>
					<view class="list_meun_dect">建议字数300字以内</view>
					<robin-editor class="editor" 
					    @cancel="hideEditor" 
					    @save="saveEditor" 
					    v-model="html"
					    :imageUploader="uploadImg" 
					    :muiltImage="true">
					</robin-editor>
				</view>
				<view class="list_meun1">
					<view class="list_meun_title list_meun1_title">自定义分享图</view>
					<view class="list_meun_dect">建议尺寸 300px*240px</view>
					<u-upload
						:fileList="fileList"
						@afterRead="afterRead"
						@delete="deletePic"
						name="6"
						multiple
						:maxCount="1"
						width="250"
						height="150"
					>
					<view class="upload_img" style="border: 2rpx solid #eee;">
						<u-icon name="plus-circle-fill" color="#2979ff" size="28"></u-icon>
						<text>上传图片</text>
					</view>
					</u-upload>
				</view>
				<view class="footer">
					<text class="footer_btn">下一步</text>
				</view>
			</view>
		</view>
		<view class="" v-if="current == 1">
			<view class="list">
				<view class="">
					<view class="list_meun list_meun2">
						<text class="list_meun_title">投票开始时间</text>
						<view class="arrow">{{startDate}} <u-icon name="arrow-right" size="16"></u-icon></view>
					</view>
					<DateTimePicker
					  :defaultDate="startDate"
					  :mode="mode"
					  @onChange="onChangeStartDate"
					/>
				</view>
				<view class="">
					<view class="list_meun list_meun2">
						<text class="list_meun_title">投票结束时间</text>
						<view class="arrow">{{endDate}} <u-icon name="arrow-right" size="16"></u-icon></view>
					</view>
					<DateTimePicker
					  :defaultDate="endDate"
					  :mode="mode"
					  @onChange="onChangeStartDate"
					/>
				</view>
			</view>
		</view>
		<view class="" v-if="current == 2">
			
		</view>
		<view class="" v-if="current == 3">
			
		</view>
		<image :src="url" v-if="url" mode="widthFix"></image>
		<l-clipper 
			v-if="show" 
			:isShowCancelBtn="isShowCancelBtn"
			:isShowPhotoBtn="isShowPhotoBtn"
			:isShowConfirmBtn="isShowConfirmBtn"
			@success="url = $event.url; show = false" 
			@cancel="show = false" >
			<!-- 四个基本按钮插槽 -->
			<view slot="cancel">取消</view>
			<view slot="photo">选择图片</view>
			<view slot="confirm">确定</view>
		</l-clipper>
		<!-- <button @tap="show = true">裁剪</button> -->
	</view>
</template>

<script>
	import DateTimePicker from '../../components/dengrq-datetime-picker/dateTimePicker/index.vue';
	
	export default {
		components: {
		  DateTimePicker
		},
		data() {
			return {
				current:0,
				numList: [{
					name: '基本设置'
				}, {
					name: '时间&报名'
				}, {
					name: '高级设置'
				}, {
					name: '添加选手'
				}, ],
				show: false,
				url: '',
				isShowCancelBtn: true,
				isShowPhotoBtn: true,
				isShowConfirmBtn: true,
				fileList6:[],
				html:"",
				startDate: '2022-07-22 00:00:00',
				endDate: '2022-08-05 00:00:00',
				mode: 4 
			}
		},
		mounted() {
			
		},
		onLoad(options){
			
		},
		methods:{
			step(data){
				console.log(data)
				this.current =data
			},
			afterRead(){
				
			},
			deletePic(){
				
			},
			onChangeStartDate(date) {
			  this.startDate = date;
			}
		}
		
	}
</script>

<style>
	page{
		background: #f6f6f6 !important;
	}
</style>
<style scoped lang="scss">
	
	.home{
		.list{
			padding: 0 30rpx;
			margin-bottom: 120rpx;
			background: #fff;
			margin-top: 20rpx;
			.editor{
				height: 300rpx;
			}
			.arrow{
				display: flex;
				align-items: center;
			}
			.list_meun{
				display: flex;
				align-items: center;
				border-bottom: 2rpx solid #eee;
				height: 110rpx;
				margin-bottom: 24rpx;
			}
			.list_meun1{
				border-bottom: 2rpx solid #eee;
				margin-bottom: 24rpx;
				padding-bottom: 20rpx;
			}
			.list_meun2{
				display: flex;
				align-items: center;
				justify-content: space-between;
			}
			.list_meun_title{
				font-size: 30rpx;
				color: #303133;
				font-weight: bold;
				width: 200rpx;
			}
			.list_meun_dect{
				font-size: 24rpx;
				color: #c0c4cc;
				margin-top: 10rpx;
				margin-bottom: 15rpx;
			}
			.list_meun_input{
				width: 100%;
				outline: none;
				height: 100rpx;
				font-size: 30rpx;
				color: #303133;
			}
		}
		.upload_img{
			border: 4rpx solid #eee;
			width: 400rpx;
			height: 210rpx;
			border-radius: 12rpx;
			display: flex;
			align-items: center;
			flex-direction: column;
			justify-content: center;
			text{
				font-size: 28rpx;
				color: #666;
				margin-top: 15rpx;
			}
		}
		.footer{
			position: fixed;
			bottom: 0;
			height: 110rpx;
			width: 100%;
			display: flex;
			align-items: center;
			justify-content: center;
			background: #fff;
			
		}
		.footer_btn{
			background: #3c9cff;
			width: 65%;
			height: 80rpx;
			font-size: 28rpx;
			color: #fff;
			display: flex;
			align-items: center;
			justify-content: center;
			border-radius: 100rpx;
		}
	}
</style>